<template>
	<view class="content">
		<view class="group">
			<image :src="group.backgroundUrl" mode="widthFix"></image>
		</view>
		<product-list :productList = "productList"></product-list>
		<!-- <cashier></cashier> -->
	</view>
</template>

<script>
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	import productList from '@/components/product-list.vue';
	import cashier from '@/components/cashier.vue'
	export default {
		components: {
			uniLoadMore	,
			productList,
			cashier
		},
		data() {
			return {
				groupId:''	,//商品组ID
				group:{},
				productList:[],
				cates:[]
			};
		},
		
		onLoad(options){
			this.groupId = options.groupId;
			/* this.inquiryProductCate(); */
			this.inquiryGroup();
		},
		methods: {
			//商品类目
			inquiryProductCate() {
				let that = this;
				this.$api.request.productCate({
			
				}, res => {
					if (res.body.status.statusCode === '0') {
						this.cates = res.body.data.cates;
					} else {
						console.log(res.body.status.errorDesc);
					}
				});
			},
			//搜索商品
			inquiryGroup(){
				let postData = {
					groupUuid: this.groupId
				};
				//加载中
				this.$api.request.productGroup(postData, res => {
					this.group = res.body.data;
					this.productList = res.body.data.productList;
				},false);
			},
			//搜索商品
			filterProductByCate(cate){
				
			},
			//详情
			navToDetailPage(item){
				let id = item.productUuid;
				uni.navigateTo({
					url: `/pages/product/product?id=${id}`
				})
			}
		},
	}
</script>

<style lang="scss">
	page, .content{
		background: $page-color-base;
	}
	.group{
		width: 100%;
		image{
			width: 100%;
		}
	}
</style>
